package baduga.server;

import java.util.HashMap;


public class Serwer {
	
	
	/** Kolekcja graczy */
	private HashMap<String, Player> colPlayers = new HashMap<String, Player>();
	
	/** Kolekcja stołów */
	private HashMap<String, Table> colTables = new HashMap<String, Table>();
	
	
	/**
	 * Dodaje gracza do listy
	 * 
	 * @param colPlayers
	 * @param key
	 * @return
	 */
	public boolean addPlayer(Player colPlayers, String key)
	{
		if(this.colPlayers.containsKey(key))
		{
			this.colPlayers.put(key, colPlayers);
			return true;
		}
		else
			return false;
	}
	
	
	/**
	 * Usuwa Gracza z Listy
	 * 
	 * @param key
	 * @return
	 */
	public boolean removePlayer(String key)
	{
		if(this.colPlayers.containsKey(key))
		{
			this.colPlayers.remove(key);
			return true;
		}
		else
			return false;
	}
	
	
	
	public boolean addTable(Table colTable, String key)
	{
		if(this.colTables.containsKey(key))
		{
			this.colTables.put(key, colTable);
			return true;
		}
		else
			return false;
	}
	
	
	public boolean removeTable(String key)
	{
		if(this.colTables.containsKey(key))
		{
			this.colTables.remove(key);
			return true;
		}
		else
			return false;
	}

}
